<template>
  <a-modal
    :visible="visible"
    :title="$t('key.shxmsb')"
    :width="1600"
    :bodyStyle="{
      height: '500px',
      overflow: 'auto'
    }"
    :closable="false"
    okText="提交审核"
    @cancel="() => { $emit('cancel') }"
    @ok="confirm"
  >
    <detail-list :col="3">
      <detail-list-item :term="$t('key.xh')">{{ info.xht }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.name')">{{ info.xsxx.xm }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.yx')">{{ info.xsxx.xjxx.ssyxmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.zy')">{{ info.xsxx.xjxx.sszymc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.rxny')">{{ info.xsxx.xjxx.rxny.split(' ')[0] }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.dsxm')">{{ info.xsxx.xjxx.dsxm }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.pyccmc')">{{ info.xsxx.xjxx.pyccmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.xslxfs')">{{ info.xsxx.lxdh }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.birthDate')">{{ info.xsxx.csrq }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.birthPalce')">{{ info.xsxx.csdcdmc }}&nbsp;{{ info.xsxx.csdxqdmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.sex')">{{ info.xsxx.xbmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.politicalLandscape')">{{ info.xsxx.zzmmmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.national')">{{ info.xsxx.mzmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.ssxk')">{{ info.xsxx.xjxx.xkmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.dslxfs')">{{ info.xsxx.xjxx.dslxdh }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.xmsbnj')">{{ info.xmsbnj }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.xmsbmc')">{{ info.projectName }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.sblx" :term="$t('key.sblx')">{{ info.sblxmc }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.nfxsj" :term="$t('key.nfxsj')">{{ info.nfxsj.format('YYYY-MM-DD') }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.nsqfxjgzw" :term="$t('key.nsqfxjgc')">{{ info.nsqfxjgzw }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.nsqfxjgyw" :term="$t('key.nsqfxjge')">{{ info.nsqfxjgyw }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.nsqfxxkzw" :term="$t('key.nsqfxxkzw')">{{ info.nsqfxxkzw }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.nsqfxxkyw" :term="$t('key.nsqfxxkyw')">{{ info.nsqfxxkyw }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.gwdsxm" :term="$t('key.gwdsxm')">{{ info.gwdsxm }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.gwdszc" :term="$t('key.gwdszc')">{{ info.gwdszc }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.gwdslxfs" :term="$t('key.gwdslxfs')">{{ info.gwdslxfs }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.khfsmc" :term="$t('key.khfsId')">{{ info.khfsmc }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.wycj" :term="$t('key.wycj')">{{ info.wycj }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hymczw" :term="$t('key.hymczw')">{{ info.hymczw }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hymcyw" :term="$t('key.hymcyw')">{{ info.hymcyw }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hyxs" :term="$t('key.hyxs')">{{ info.hyxs=='ktbg'?'口头报告':'张贴海报' }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.tm" :term="$t('key.tm')">{{ info.tm }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hyzbfqc" :term="$t('key.hyzbfqc')">{{ info.hyzbfqc }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hywz" :term="$t('key.hywz')">{{ info.hywz }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hydd" :term="$t('key.hydd')">{{ info.hydd }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hysj" :term="$t('key.hysj')">{{ info.hysj.format('YYYY-MM-DD') }}&nbsp;</detail-list-item>

        <detail-list-item v-if="info.gjfy" :term="$t('key.gjfy')">{{ info.gjfy }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hyzcf" :term="$t('key.hyzcf')">{{ info.hyzcf }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.yszje" :term="$t('key.yszje')">{{ info.yszje }}&nbsp;</detail-list-item>
    </detail-list>
        <a-row style="padding-bottom:16px" v-if="info.xxgjjlList && info.xxgjjlList.length">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.xxgzjl')}}:</div>
           <div class="content" v-for="(item,i) in info.xxgjjlList" v-if="item.kssj&& item.jssj" :key="item.id">{{i+1}}.{{item.kssj}}~{{item.jssj}}{{item.xxggdw}}</div>
           <div v-else class="content">无</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.bsjdkexxxqk">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.bsjdkexxxqk')}}:</div>
           <div class="content" >{{ info.bsjdkexxxqk }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.fxml">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.fxml')}}:</div>
           <div class="content" >{{ info.fxml }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.fxnr">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.fxnr')}}:</div>
           <div class="content" >{{ info.fxnr }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.jtssbz">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.jtssbz')}}:</div>
           <div class="content" >{{ info.jtssbz }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.bhylylwtmdjzz">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.bhylylwtmdjzz')}}:</div>
           <div class="content" >{{ info.bhylylwtmdjzz }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.hyqksm">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.hyqksm')}}:</div>
           <div class="content" >{{ info.hyqksm }}</div>
         </a-col>
       </a-row>
    <!-- <detail-list :col="1">
      <detail-list-item v-if="info.bsjdkexxxqk" :term="$t('key.bsjdkexxxqk')">{{ info.bsjdkexxxqk }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.fxml" :term="$t('key.fxml')">{{ info.fxml }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.fxnr" :term="$t('key.fxnr')">{{ info.fxnr }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.jtssbz" :term="$t('key.jtssbz')">{{ info.jtssbz }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.bhylylwtmdjzz" :term="$t('key.bhylylwtmdjzz')">{{ info.bhylylwtmdjzz }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hyqksm" :term="$t('key.hyqksm')">{{ info.hyqksm }}&nbsp;</detail-list-item>
      </detail-list> -->
      <a-row style="padding-bottom:16px" v-if="info.coursewareLis && info.coursewareLis.length">
        <div class="term" style="color: rgba(0, 0, 0, 0.85)">上传附件:</div>
      <a-upload
        :default-file-list="defaultFileList"
      >
      </a-upload>
      </a-row>
    <template v-if="!type">
    <a-form :form="form">
      <a-col :span="6">
        <a-form-item
          label="审核结果"
        >
          <a-select v-decorator="['dsshzt',
            {
              rules: [{ required: true, message: '请选择导师审核结果!' }],
            }]" >
            <a-select-option value="03">通过</a-select-option>
            <a-select-option value="04">不通过</a-select-option>
           <!-- <a-select-option value="78">建议修改或补充</a-select-option> -->
          </a-select>
        </a-form-item>
      </a-col>

      <a-col :span="24">
        <a-form-item
          label="申请人指导教师推荐意见（包括：对申请人科研能力的评价，对申请人学术发展潜力的评估等）"
        >
          <a-textarea v-decorator="['dsshyy',
            {
              rules: [{ required: true, message: '请输入申请人指导教师推荐意见（包括：对申请人科研能力的评价，对申请人学术发展潜力的评估等' }],
            }]" />
        </a-form-item>
      </a-col>

    </a-form>
    </template>
    <template v-else>
       <a-row style="padding-bottom:16px" v-if="info.dsshzt">
         <a-col :span="8">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.dsshzt')}}:</span>
           <span>{{info.dsshzt == '03'?'通过':'不通过'}}</span>
         </a-col>
         <a-col :span="16">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.dsshyj')}}:</span>
           <span>{{info.dsshyy}}</span>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.yxshzt">
         <a-col :span="8">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.yxshzt')}}:</span>
           <span>{{info.yxshzt == '05'?'通过':'不通过'}}</span>
         </a-col>
         <a-col :span="16">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.yxshyj')}}:</span>
           <span>{{info.yxshyy}}</span>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.yjsyzhbshzt">
         <a-col :span="8">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.zhbshzt')}}:</span>
           <span>{{info.yjsyzhbshzt == '07'?'通过':'不通过'}}</span>
         </a-col>
         <a-col :span="16">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">{{$t('key.zhbshyj')}}:</span>
           <span>{{info.yjsyzhbshyy}}</span>
         </a-col>
       </a-row>
   <p style="text-align: center" slot="footer" ><a-button type="primary" @click="() => { $emit('cancel') }">关闭</a-button></p>
    </template>
  </a-modal>

</template>

<script>
    import {STable} from '~'
    import DetailList from '~/tool/DetailList'
    import moment from 'moment'

    const DetailListItem = DetailList.Item

export default {
  props:['visible','info'],
  components: {DetailList, DetailListItem, STable},
  data () {
    return {
      form: this.$form.createForm(this),
     rptInfo: {
      //   yjjds: []
      },
      defaultFileList:[],
      type:'',
      // defaultFileList: [
      //   {
      //     uid: '1',
      //     name: 'xxx.png',
      //     status: 'done',
      //     response: 'Server Error 500', // custom error message to show
      //     url: 'http://www.baidu.com/xxx.png',
      //   },
      // ],
       /*columns: [
        {
          title: '起讫日期',
          width: 200,
          scopedSlots: { customRender: 'qsrq' }
        },
        {
          title: '主要研究内容',
          dataIndex: 'zyyjnr'
        },
        {
          title: '预期结果',
          width: 650,
          dataIndex: 'yqjg'
        }
      ], */
      tableData: [],
     /* zjcolumns: [
        {
          title: '姓名',
          scopedSlots: { customRender: 'xm' }
        },
        {
          title: '职称',
          scopedSlots: { customRender: 'zc' }
        },
        {
          title: '所在单位、现从事专业',
          scopedSlots: { customRender: 'dw' }
        },
        {
          title: '操作',
          scopedSlots: { customRender: 'action' }
        }
      ] */
    }
  },
  watch:{
    info(){
      console.log(this.type)
      this.info.xsxx.csrq = moment(this.info.xsxx.csrq).format('YYYY-MM-DD')
      this.$api.student.baseInfo().then(res =>{
        if(res.data.xmsb){
          res.data.xmsb.map(item => {
            if(item.name == this.info.xmsbId){
            //   this.rptInfo.xmsbName = item.title
              this.$set(this.info,'xmsbName',item.title)
            }
          })
        }
        if(this.info.sblx){
          res.data.Sblx.map(item =>{
            if(item.name == this.info.sblx){
              this.$set(this.info,'sblxmc',item.title)
            }
          })
        }
      })
      if(this.info.coursewareLis && this.info.coursewareLis.length){
      this.info.coursewareLis.map(item =>{
        item.name = item.sourceName
        item.uid = item.id
      })
      this.defaultFileList = this.info.coursewareLis
      }
    }
  },
  methods: {
    newRow () {
      /* let hasEdit = this.tableData.find(d => {
        return d.editable
      }) */
    /*  if (hasEdit) {
        return this.$message.warning('请先完成前面的添加')
      }
      this.tableData.push({
        xm: '',
        zc: '',
        dw: '',
        action: '',
        editable: true
      }) */
    },
    remove (index) {
      this.tableData.splice(index, 1)
    },
    completeAdd (data) {
     /* if (data.xm && data.zc && data.dw) {
        return this.$set(data, 'editable', false)
      }
      this.$message.error('请输入完整的评审专家信息') */
    },
    confirm () {
      this.form.validateFields((err, values) => {
        if (err) return
        // if (!this.tableData.length) {
        //   return this.$message.error('评审专家不能为空')
        // }
        let params = Object.assign({
          // yxshyj: values.yxshzt === '09' ? '同意' : (values.yxshzt === '08' ? '不同意' : '建议修改或补充'),
          id: this.info.id,
          yxsh:this.info.xsxx.xjxx.ssyxm
          // specialist: JSON.stringify(this.tableData)
        }, values)
        this.$api.student.projectSh(params).then(res => {
          this.$message.success(res.msg)
          this.form.resetFields()
          this.$emit('cancel')
          this.$emit('refresh')
        })
      })
    }
  }
}
</script>

<style>

</style>
